package com.mall.b2c.bean;

import java.math.BigDecimal;

public class CartItemBean {
	private Long id;
	private Long goodsId;
	private String productName;
	private String productCode;
	private String spec;
	private String image;
	private String manufacturer;
	private BigDecimal price;
	private Integer quantity;
	private String path;
	private String cateCode;//分类code

	public CartItemBean() {
		super();
	}

	public CartItemBean(GoodsBean goods, Integer quantity){
		this.id = goods.getId();
		this.goodsId = goods.getId();
		this.quantity = quantity;
		this.productName = goods.getName();
		this.productCode = goods.getCode();
		this.spec = goods.getSpec();
		this.image = goods.getImage_default();
		this.manufacturer = goods.getManufacturer();
		this.price = goods.getPrice();
		this.path = goods.getPath();
		this.cateCode = goods.getGoodsCategoryCode();
	}

	public String getPath() {
		return path;
	}

	public BigDecimal getSubtotal(){
		if(price != null && quantity != null){
			return price.multiply(BigDecimal.valueOf(quantity));
		}
		return null;
	}

	public String getCateCode() {
		return cateCode;
	}

	public void setCateCode(String cateCode) {
		this.cateCode = cateCode;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Long goodsId) {
		this.goodsId = goodsId;
	}
	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getProductCode() {
		return productCode;
	}

	public void setProductCode(String productCode) {
		this.productCode = productCode;
	}

	public String getSpec() {
		return spec;
	}

	public void setSpec(String spec) {
		this.spec = spec;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

}
